#include "server.hpp"


int main()
{
    Socket clientsocket;
    if (!clientsocket.CreateConnection(8080))
    {
        ERR_LOG("create connection error");
        return 0;
    }

    int cnt = 5;
    while (cnt--)
    {
        std::string str = "hello wrold";
        int ret = clientsocket.Send(str.c_str(), str.size());
        if (ret < 0)
        {
            ERR_LOG("client send error");
            return -1;
        }

        char buffer[1024] = { 0 };
        int n = clientsocket.Recv(buffer, sizeof(buffer));
        if (n <= 0)
        {
            ERR_LOG("client recv error");
            return -1;
        }
        buffer[n] = 0;
        DBG_LOG("%s", buffer);
        sleep(1);
    }
    sleep(10);

    return 0;
}